﻿// *********************************************************************
// [DCOM Productions]
// [Copyright (C) DCOM Productions All rights reserved.]
// *********************************************************************

namespace BitFlex.Windows.Forms {
    using System;
    using System.Windows.Forms;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Collections.ObjectModel;
    using System.Drawing;

    /// <summary>
    /// Represents a link that is used in conjunction with the HyperCommandLink control.
    /// </summary>
    public class HyperCommandSubLink {
        /// <summary>
        /// Instantiates a new instance of the BitFlex.Windows.Forms.HyperCommandSublink class.
        /// </summary>
        public HyperCommandSubLink() {
            m_Command = "HyperCommandSublinkCommand";
            m_Text = "HyperCommandSublink";
        }

        /// <summary>
        /// Instantiates a new instance of the BitFlex.Windows.Forms.HyperCommandSublink class.
        /// </summary>
        public HyperCommandSubLink(String text) {
            m_Command = "HyperCommandSublinkCommand";

            if (String.IsNullOrEmpty(text)) {
                throw new System.ArgumentNullException("text", "You can not specify an empty string as a parameter.");
            }
            else {
                m_Text = text;
            }
        }

        /// <summary>
        /// Instantiates a new instance of the BitFlex.Windows.Forms.HyperCommandSublink class.
        /// </summary>
        public HyperCommandSubLink(String text, String command) {
            if (String.IsNullOrEmpty(text) || String.IsNullOrEmpty(command)) {
                throw new System.ArgumentNullException("text", "You can not specify an empty string as a parameter.");
            }
            else {
                m_Command = command;
                m_Text = text;
            }
        }

        #region Fields

        internal HyperCommandLink m_ParentControl = null;

        #endregion

        #region Properties

        private String m_Command = String.Empty;
        /// <summary>
        /// Gets or Sets the command ID that is used to determine which HyperCommandSublink was clicked on the parent control
        /// </summary>
        public String Command {
            get {
                return m_Command;
            }
            set {
                m_Command = value;
            }
        }

        private Image m_Image = null;
        /// <summary>
        /// Gets or Sets the control's image
        /// </summary>
        public Image Image {
            get {
                return m_Image;
            }
            set {
                m_Image = value;

                if (m_ParentControl != null) {
                    m_ParentControl.Invalidate();
                }
            }
        }

        private String m_Text = String.Empty;
        /// <summary>
        /// Gets or Sets the control's text
        /// </summary>
        public String Text {
            get {
                return m_Text;
            }
            set {
                m_Text = value;

                if (m_ParentControl != null) {
                    m_ParentControl.Invalidate();
                }
            }
        }

        #endregion
    }
}